package team.kirohuji.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import team.kirohuji.dao.UserInfoDao;
import team.kirohuji.domain.UserInfo;
import team.kirohuji.service.UserInfoService;

/**
 * 系统用户服务实现类
 * @author kirohuji
 *
 */
@Service("userInfoService")
public class UserInfoServiceImpl implements UserInfoService {

    /**
     * @see UserInfoDao
     * UserInfoDao
     */
    @Resource
    private UserInfoDao UserInfoDao;
   
    /* 
     * 查询一条记录通过用户Id
     * (non-Javadoc)
     * @see team.kirohuji.service.UserInfoService#queryObject(java.lang.Integer)
     * @param userId 用户主键
     * @return UserInfo
     */
    @Override
    public UserInfo queryObject(Integer userInfoId) {

        return UserInfoDao.queryObject(userInfoId);
    }

    /* 
     * 查询一组记录
     * (non-Javadoc)
     * @see team.kirohuji.service.UserInfoService#queryList(java.util.Map)
     * @param map map对象
     * @return UserInfo列表
     */
    @Override
    public List<UserInfo> queryList(Map<String, Object> map) {

        return UserInfoDao.queryList(map);
    }

    /* 
     * 查询全部
     * (non-Javadoc)
     * @see team.kirohuji.service.UserInfoService#queryTotal(java.util.Map)
     * @param map map对象
     * @return int
     */
    @Override
    public int queryTotal(Map<String, Object> map) {

        return UserInfoDao.queryTotal(map);
    }

    /* 
     * 存入一条记录
     * (non-Javadoc)
     * @see team.kirohuji.service.UserInfoService#save(team.kirohuji.domain.UserInfo)
     * @param user 用户
     * @throws IllegalArgumentException 
     */
    @Override
    @Transactional
    public void save(UserInfo userInfo) throws IllegalArgumentException {
    	UserInfoDao.save(userInfo);
    }

    /* 
     * 更新
     * (non-Javadoc)
     * @see team.kirohuji.service.UserInfoService#update(team.kirohuji.domain.UserInfo)
     * @param user 用户
     * @throws IllegalArgumentException
     */
    @Override
    @Transactional
    public void update(UserInfo userInfo) throws IllegalArgumentException {
    	UserInfoDao.update(userInfo);
    }

    /* 
     * 批量删除
     * (non-Javadoc)
     * @see team.kirohuji.service.UserInfoService#deleteBatch(java.lang.Integer[])
     * @param userIds 用户主键数组
     */
    @Override
    @Transactional
    public void deleteBatch(Integer[] userInfoIds) {
        UserInfoDao.deleteBatch(userInfoIds);
    }
}